package GUI;

import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import MessagePacks.GetAllPack;
import MessagePacks.MessagePack;

import java.awt.Font;
import java.util.Iterator;

/**
 *@author Juan Alapin - 324507516
 *@author Giora Yaffe - 036551281
 *@author Shachar Gritzman - 300174026
 *@author Nir Porat - 021515580
*/

public class ShowAllWorkers extends IS_dep_manager{

	private static final long serialVersionUID = 1L;
	private MainGUI mainGui;
	private GetAllPack getWorkers;
//	ArrayList<String> mMap = new ArrayList<String>();


	public ShowAllWorkers(MainGUI mainGui) {
		super(mainGui);
		this.mainGui= mainGui;
		
		getworkers();
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(271, 107, 487, 366);
		getContentPane().add(scrollPane);
		
		JTextArea textArea = new JTextArea();
		scrollPane.setViewportView(textArea);
		textArea.setFont(new Font("Courier New", Font.PLAIN, 18));		
		Iterator<String> iter = getWorkers.nArray.iterator();
		while(iter.hasNext()){
			String Box = iter.next();
			textArea.append(Box); }
		textArea.setEditable(false);
	}
	
	public void getworkers(){
		getWorkers= new GetAllPack(MessagePack.getworkerslist);
		mainGui.client.handleMessageFromClientUI(getWorkers);
		getWorkers= (GetAllPack) mainGui.client.getMessage(); 
		}
	
}
